<?php
/**
 * Created by PhpStorm.
 * User: 小蛮哼哼哼
 * Email: 243194993@qq.com
 * Date: 2021/11/23
 * Time: 10:37
 * motto: 现在的努力是为了小时候吹过的牛逼！
 */

declare(strict_types=1);

namespace app\api\controller\v1;

use app\api\controller\Base;
use app\common\business\Advert;
use app\common\business\Capsule;
use app\common\lib\Show;
use app\common\lib\Status;

class Banner extends Base
{
    public function getBannerList()
    {
        try {
            $banner = (new \app\common\business\Banner())->getBannerByList("id,img as img_url");
            $advert = (new Advert())->getAdvertByList("id,img as img_url");
            $capsule = (new Capsule())->getAdvertByList("id,img as img_url");
        } catch (\Exception $e) {
            return Show::json_show(Status::mini_error, $e->getMessage());
        }
        return Show::json_show(Status::mini_normal, "ok", [
            "banner_list" => array_column($banner,'img_url'),
            "advert_list" => array_column($advert,'img_url'),
            "capsule_list" => array_column($capsule,'img_url'),
        ]);
    }
}